﻿''' <summary>
''' 锐剑财务系统 程序信息表 
''' 对应表：sysSoftInfo
''' </summary>
Public Class RjClsSoftInfoDbAccess
    Inherits ClsBaseDbAccess

    Public Sub New(ByVal s As String)
        MyBase.New(s, TABLE_NAME_RJ_SYS_SOFTINFO)
    End Sub

    Public Sub New(ByVal s As String, ByVal n As String)
        MyBase.New(s, n)
    End Sub

    Public Function GetRjCwSoftInfo() As RjClsSoftInfo

        Dim tmpRetCls As RjClsSoftInfo = Nothing

        Try
            Dim tmpDb As ClsDbAccessMdb = GetConnection()
            Dim tmpList As List(Of RjClsSoftInfo)
            Dim tmpParas(0) As OleDb.OleDbParameter
            Dim tmpSql As String = "Select * from  [" & Me.AppTableName & "] "

            '打开数据库
            tmpDb.DbOpen()

            '执行
            tmpList = CType(ConvertRecordToClass(tmpDb.ExecuteSqlReturnDataSet(tmpSql, New OleDb.OleDbParameter() {})), List(Of RjClsSoftInfo))

            If tmpList IsNot Nothing Then
                tmpRetCls = tmpList(0)
            End If

            '关闭数据库
            tmpDb.DbClose()

        Catch ex As OleDb.OleDbException

            mErrorCreater = "ClsTAccountDbAccess - GetRjCwSysName"
            mErrorMessage = ex.Message
            mErrorNumber = ex.ErrorCode

        End Try

        Return tmpRetCls

    End Function

    Public Overrides Function ConvertRecordToClass(reader As OleDb.OleDbDataReader) As Object

        If reader Is Nothing Then
            Return Nothing
        End If

        Try

            Dim tmpList As List(Of RjClsSoftInfo) = New List(Of RjClsSoftInfo)
            Dim tmpCls As RjClsSoftInfo

            While reader.Read()

                tmpCls = New RjClsSoftInfo()

                With tmpCls
                    .StrSoftName = reader.GetString(0) 'As String '01 软件名称
                    .StrSoftVersion = reader.GetString(1) 'As String '02 软件版本
                    .CorName = ConvertDbNullString(reader(2)) 'As String '03 作者公司
                    .Web = ConvertDbNullString(reader(3)) ' As String '04 作者网址
                    .Email = ConvertDbNullString(reader(4)) 'As String '05 作者邮箱
                    .SysMemo = ConvertDbNullString(reader(5)) 'As String '06 基本介绍
                    .BuildTime = ConvertDbNullDateTime(reader(6)) 'As String '07 发布时间
                    .CopyInfo = ConvertDbNullString(reader(7)) 'As String '08 版权类型
                    .SysExpire = ConvertDbNullDateTime(reader(8)) 'As String '09 过期时间
                    .IfReged = reader.GetBoolean(9) 'As Boolean '10 是否注册
                    .StrRegCode = ConvertDbNullString(reader(10)) ' As String '11 注册码

                End With

                tmpList.Add(tmpCls)

            End While

            Return tmpList

        Catch ex As Exception

            mErrorNumber = -1001
            mErrorMessage = ex.Message
            mErrorCreater = "ClsTVoucherGroupDbAccess - ConvertRecordToClass"

            Return Nothing
        End Try

    End Function
End Class
